package com.ruoyi.web.controller.system.Fdongbei;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.Fdongbei.domain.TbYcXxqk;
import com.ruoyi.system.Fdongbei.service.ITbYcXxqkService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 异常接收Controller
 * 
 * @author ruoyi
 * @date 2025-01-23
 */
@RestController
@RequestMapping("/system/xxqk")
public class TbYcXxqkController extends BaseController
{
    @Autowired
    private ITbYcXxqkService tbYcXxqkService;

    /**
     * 查询异常接收列表
     */
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbYcXxqk tbYcXxqk)
    {
        startPage();
        List<TbYcXxqk> list = tbYcXxqkService.selectTbYcXxqkList(tbYcXxqk);
        return getDataTable(list);
    }


    /**
     * 查询异常接收列表
     */
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
    @GetMapping("/listwc")
    public TableDataInfo listwc(TbYcXxqk tbYcXxqk)
    {
        startPage();
        List<TbYcXxqk> list = tbYcXxqkService.selectTbYcXxqkListwc(tbYcXxqk);
        return getDataTable(list);
    }

    /**
     * 导出异常接收列表
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:xxqk:export')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "异常接收", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbYcXxqk tbYcXxqk)
    {
        List<TbYcXxqk> list = tbYcXxqkService.selectTbYcXxqkList(tbYcXxqk);
        ExcelUtil<TbYcXxqk> util = new ExcelUtil<TbYcXxqk>(TbYcXxqk.class);
        util.exportExcel(response, list, "异常接收数据");
    }

    /**
     * 获取异常接收详细信息
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:xxqk:query')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbYcXxqkService.selectTbYcXxqkById(id));
    }

    /**
     * 新增异常接收
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:xxqk:add')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "异常接收", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbYcXxqk tbYcXxqk)
    {
        return toAjax(tbYcXxqkService.insertTbYcXxqk(tbYcXxqk));
    }

    /**
     * 修改异常接收
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:xxqk:edit')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "异常接收", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbYcXxqk tbYcXxqk)
    {
        return toAjax(tbYcXxqkService.updateTbYcXxqk(tbYcXxqk));
    }

    /**
     * 删除异常接收
     */
<<<<<<< HEAD
    @PreAuthorize("@ss.hasPermi('system:xxqk:list')")
=======
    @PreAuthorize("@ss.hasPermi('system:xxqk:remove')")
>>>>>>> b4a0e2dba4b1f1e0b05e6d155df4272830d06f27
    @Log(title = "异常接收", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbYcXxqkService.deleteTbYcXxqkByIds(ids));
    }
}
